home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / csubrtns.arc / INDEX.C < prev    next >
Encoding:
Text File  |  1985-07-06  |  384 b   |  16 lines

  1. /* index.c by Michael Hanson */
  2. /* you may use this, but not for profit, and give me credit */ 
  3. /* find index of char c in string str */
  4.  
  5. index(str,c)
  6. char c;
  7. char str[];
  8. {
  9.     int ind;
  10.  
  11.     for(ind = 0; str[ind] != EOS ; ++ind)
  12.         if(str[ind] == c)
  13.             return(ind);
  14.     return(-1);
  15. }
  16.